import Mock from 'mockjs'

let data = [
    {
        id: 1,
        title: "详情---商品1"
    },
    {
        id: 2,
        title: "详情---商品2"
    },
    {
        id: 3,
        title: "详情---商品3"
    }
]

Mock.mock(RegExp('/getDetail' + ".*"), (req) => {
    const id = req.url.split("=")[1]
    const res = data.filter(item => item.id === Number(id))[0]
    return res
})